From: Tim Starling Date: Tue, 4 May 2004 14:36:42 +0000 (+0000) Subject: Orphan creating feature -- go redirects to edit if the page doesn't exist, off by... X-Git-Tag: 1.3.0beta1~152 X-Git-Url: http://git.cyclocoop.org/%7B%24admin_url%7Dmembres/Subpage_test/1/2/%5B%27/%40%20%27icone_supprimer_signature%27%20=%3E%20%27Delete%20this%20signature%27%2C%20%27icone_valider_signature%27%20=%3E%20%27Validate%20this%20signature%27%2C%20%27image_administrer_rubrique%27%20=%3E%20%27You%20can%20manage%20this%20section%27%2C-%27impossible_modifier_login_auteur%27%20=%3E%20%27Login%20cannot%20be%20changed.%27%2C-%27impossible_modifier_pass_auteur%27%20=%3E%20%27Password%20cannot%20be%20changed.%27%2C%20%27info_1_article%27%20=%3E%20%271%20article%27%2C-%27info_1_article_syndique%27%20=%3E%20%271%20syndicated%20article%27%2C%20%27info_1_auteur%27%20=%3E%20%271%20author%27%2C%20%27info_1_message%27%20=%3E%20%271%20message%27%2C%20%27info_1_mot_cle%27%20=%3E%20%271%20keyword%27%2C%20%27info_1_rubrique%27%20=%3E%20%271%20section%27%2C-%27info_1_site%27%20=%3E%20%271%20site%27%2C%20%27info_1_visiteur%27%20=%3E%20%271%20visitor%27%2C%20%27info_activer_cookie%27%20=%3E%20%27You%20can%20activate%20an%20%3Cb%3Eadministration%20cookie%3C/b%3E%2C%20which%20allows%20you%20%20to%20switch%20easily%20between%20the%20public%20site%20and%20the%20private%20area.%27%2C%40%40%20-249%2C16%20%20213%2C13%20%40%40%20Do%20not%20submit%20this%20import%20request.%3Cp%3EFor%20more%20information%2C%20please%20see%20%3Ca%20href=?a=commitdiff_plain;h=fe5eedd185b5b19aab4782b67a28558639512391;p=lhc%2Fweb%2Fwiklou.git Orphan creating feature -- go redirects to edit if the page doesn't exist, off by default --- diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index cf47423c8e..d3dde9c717 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -354,5 +354,8 @@ $wgImportSources = array(); $wgMaxCredits = 0; # Text matching this regex will be recognised as spam -$wgSpamRegex = false; +$wgSpamRegex = false; + +# Go button goes straight to the edit screen if the article doesn't exist +$wgGoToEdit = false; ?> diff --git a/includes/SearchEngine.php b/includes/SearchEngine.php index da2267701f..19a081b302 100644 --- a/includes/SearchEngine.php +++ b/includes/SearchEngine.php @@ -424,19 +424,12 @@ class SearchEngine { function goResult() { - global $wgOut, $wgRequest; + global $wgOut, $wgRequest, $wgGoToEdit; global $wgDisableTextSearch; $fname = "SearchEngine::goResult"; $search = trim( $wgRequest->getText( "search" ) ); - # Entering an IP address goes to the contributions page - if ( preg_match( '/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/', $search ) ) { - $title = Title::makeTitle( NS_SPECIAL, "Contributions" ); - $wgOut->redirect( $title->getFullUrl( "target=$search" ) ); - return; - } - # Try to go to page as entered. # $t = Title::newFromText( $search ); @@ -477,8 +470,22 @@ class SearchEngine { return; } + # Entering an IP address goes to the contributions page + if ( preg_match( '/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/', $search ) ) { + $title = Title::makeTitle( NS_SPECIAL, "Contributions" ); + $wgOut->redirect( $title->getFullUrl( "target=$search" ) ); + return; + } + # No match, generate an edit URL $t = Title::newFromText( $this->mUsertext ); + + # If the feature is enabled, go straight to the edit page + if ( $wgGoToEdit ) { + $wgOut->redirect( $t->getFullURL( "action=edit" ) ); + return; + } + $wgOut->addHTML( "

" . wfMsg("nogomatch", $t->escapeLocalURL( "action=edit" ) ) . "

\n" ); # Try a fuzzy title search